<% modelname = Subject.human_name %>
<% form_for(@subject) do |f| %>
  <%= f.error_messages %>

  <table class="form_table" cellpadding="0" cellspacing="0" style="border-top: 0px;">

    <caption style="border-bottom: 0px;">
      <%= "#{controller.action_name == 'edit' ? t(:update_x, :x => modelname) : t(:create_y, :y => modelname)}" %>
    </caption>

    <tr>
      <td class="label"><%= f.label Subject.human_attribute_name(:educational_plan) %></td>
      <td colspan="7">
        <% if @educational_plan.nil? %>
          <%=f.select(:educational_plan_id , EducationalPlan.all.collect {|p| [ p.name, p.id ] }, { :include_blank => false }) %>
        <% else %>
          <%= f.hidden_field(:educational_plan_id, :value => @educational_plan.id) %>
          <%= @educational_plan.name %>
        <% end %>
      </td>
    </tr>

    <tr>
      <td class="label"><%= f.label Subject.human_attribute_name(:name) %></td>
      <td colspan="3"><%= f.text_field :name %></td>

      <td class="label"><%= f.label Subject.human_attribute_name(:abbreviation) %></td>
      <td colspan="3"><%= f.text_field :abbreviation %></td>
    </tr>

    <tr>
      <td class="label"><%= f.label Subject.human_attribute_name(:code) %></td>
      <td><%= f.text_field :code, :style => "width: 83px;" %></td>

      <td class="label"><%= f.label Subject.human_attribute_name(:credits) %></td>
      <td><%= f.text_field :credits, :style => "width: 60px;" %></td>

      <td class="label"><%= f.label Subject.human_attribute_name(:term_number) %></td>
      <td><%= f.text_field :term_number, :style => "width: 65px;" %></td>
    </tr>
    <tr>
      <td class="label"><%= f.label Subject.human_attribute_name(:is_required) %></td>
      <td><%= f.check_box :is_required %></td>

       <td class="label"><%= f.label Subject.human_attribute_name(:is_optional_stub) %></td>
      <td><%= f.check_box :is_optional_stub %></td>
    </tr>

    <tr>
      <td class="label"><%= f.label Subject.human_attribute_name(:info) %></td>
      <td colspan="7"><%= f.text_area :info %></td>
    </tr>

    <tr>
      <td class="label"><%= f.label Subject.human_attribute_name(:bibliography) %></td>
      <td colspan="7"><%= f.text_area :bibliography %></td>
    </tr>

    <tr>
      <td class="submit" colspan="8">
        <%= f.submit controller.action_name == 'edit' ? t(:update) : t(:create) %>
      </td>
    </tr>
  </table>

<% end %>